home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / pdcurs21 / portable / echo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-18  |  1.4 KB  |  65 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3.  
  4. #ifdef UNIX
  5. #define NOTLIB
  6. #include <defs.h>
  7. #include <term.h>
  8. #endif
  9.  
  10. #undef    echo
  11.  
  12. #ifdef PDCDEBUG
  13. char *rcsid_echo = "$Header: C:\CURSES\portable\RCS\echo.c 2.1 1993/06/18 20:19:49 MH Rel MH $";
  14. #endif
  15.  
  16.  
  17.  
  18.  
  19. /*man-start*********************************************************************
  20.  
  21.   echo()    - enable/disable terminal echo
  22.  
  23.   X/Open Description:
  24.      These functions control whether characters typed by the user
  25.      are echoed by the input routine.  Initially, input characters
  26.      are echoed.  Subsequent calls to echo() and noecho() do not
  27.      flush type-ahead.
  28.  
  29.   PDCurses Description:
  30.      No additional PDCurses functionality.
  31.  
  32.   X/Open Return Value:
  33.      The echo() function returns OK on success and ERR on error.
  34.  
  35.   X/Open Errors:
  36.      No errors are defined for this function.
  37.  
  38.   Portability:
  39.      PDCurses    int echo( void );
  40.      X/Open Dec '88    int echo( void );
  41.      BSD Curses    int echo( void );
  42.      SYS V Curses    int echo( void );
  43.  
  44. **man-end**********************************************************************/
  45.  
  46. int    echo(void)
  47. {
  48. #ifdef PDCDEBUG
  49.     if (trace_on) PDC_debug("echo() - called\n");
  50. #endif
  51.  
  52. #ifdef UNIX
  53. #ifdef USE_TERMIO
  54.     _CUR_TERM.prog_mode.c_lflag |= ECHOCTL|ECHOKE;
  55.     ioctl(_CUR_TERM.fd, TCSETAW, &_CUR_TERM.prog_mode);
  56. #else
  57.     _CUR_TERM.prog_mode.sg_flags |= ECHO;
  58.     ioctl(_CUR_TERM.fd, TIOCSETP, &_CUR_TERM.prog_mode);
  59. #endif
  60. #endif
  61.  
  62.     _cursvar.echo = TRUE;
  63.     return( OK );
  64. }
  65.